package cn.com.headfree.callback.call;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import cn.com.headfree.base.controller.ResultData;
import cn.com.headfree.callback.back.WorkFlowServerCallBack;


@FeignClient(value="comm-work-flow-server",fallback=WorkFlowServerCallBack.class)
//@FeignClient(url = "${decisionEngine.url}",name="engine")
@Service("workFlowServerCall")
public interface IWorkFlowServerCall {

	/**
	 * @description 根据系统编码获取该系统下所有的工作流
	 * @author fengya
	 * @date 2020年7月1日 上午11:25:36
	 * @param sysCode
	 * @param pageSize
	 * @param pageNo
	 * @return
	 * ResultData
	 */
	@RequestMapping(value="/comm-work-flow-server/workflow/workflowinfo/findWorkFlowsBySysCode/{sysCode}",method=RequestMethod.GET)
	public ResultData findWorkFlowsBySysCode(@RequestParam("sysCode") String sysCode);

	/**
	 * @description 提交工作流
	 * @author fengya
	 * @date 2020年7月1日 上午11:26:20
	 * @param workFlowId
	 * @param businessId
	 * @param workFlowApproveCondition
	 * @param currentUserId
	 * @param approveAdvise 审批意见
	 * @param domainId 业务域id
	 * @return
	 * ResultData
	 */
	@RequestMapping(value="/comm-work-flow-server/workflow/workflowApprove/saveApproveRecord",method=RequestMethod.POST)
	public ResultData saveApproveRecord(@RequestParam("workFlowId") String workFlowId,@RequestParam("businessId") String businessId,@RequestParam("workFlowApproveCondition") String workFlowApproveCondition,@RequestParam("currentUserId") String currentUserId,@RequestParam("approveAdvise") String approveAdvise,@RequestParam("domainId") String domainId);

	/**
	 * @description 审批流程
	 * @author fengya
	 * @date 2020年7月1日 下午4:57:39
	 * @param approveId
	 * @param approveAdvise
	 * @param currentUserId
	 * @param domainId 业务域id
	 * @return
	 * ResultData
	 */
	@RequestMapping(value = "/comm-work-flow-server/workflow/workflowApprove/approveRecord", method = RequestMethod.POST)
	public ResultData approveRecord(@RequestParam("approveId") String approveId,@RequestParam("approveAdvise") String approveAdvise,@RequestParam("currentUserId") String currentUserId,@RequestParam("domainId") String domainId,@RequestParam("approveCondition") String approveCondition);

	/**
	 * @description 分页查找系统编码下所有待审批任务
	 * @author fengya
	 * @date 2020年7月1日 上午11:26:54
	 * @param sysCode
	 * @param pageSize
	 * @param pageNo
	 * @return
	 * ResultData
	 */
	@RequestMapping(value = "/comm-work-flow-server/workflow/workflowApprove/findWaitApproveWorkFlow/{sysCode}/{currentUserId}/{pageSize}/{pageNo}", method = RequestMethod.GET)
	public ResultData findWaitApproveWorkFlow(@RequestParam("sysCode") String sysCode,@RequestParam("currentUserId") String currentUserId,@RequestParam("pageSize") int pageSize,@RequestParam("pageNo") int pageNo);

	/**
	 * @description 分页查找系统编码下所有已审批任务
	 * @author fengya
	 * @date 2020年7月1日 上午11:26:54
	 * @param sysCode
	 * @param pageSize
	 * @param pageNo
	 * @return
	 * ResultData
	 */
	@RequestMapping(value = "/comm-work-flow-server/workflow/workflowApprove/findApprovedWorkFlow/{sysCode}/{currentUserId}/{pageSize}/{pageNo}", method = RequestMethod.GET)
	public ResultData findApprovedWorkFlow(@RequestParam("sysCode") String sysCode,@RequestParam("currentUserId") String currentUserId,@RequestParam("pageSize") int pageSize,@RequestParam("pageNo") int pageNo);

	/**
	 * @description 根据审批ID获取流程该节点审批条件数据
	 * @author fengya
	 * @date 2020年7月1日 下午3:59:56
	 * @param approveId
	 * @return
	 * ResultData
	 */
	@RequestMapping(value = "/comm-work-flow-server/workflow/workflowApprove/getNextWorkFlowCondition/{approveId}", method = RequestMethod.GET)
	public ResultData getNextWorkFlowCondition(@RequestParam("approveId") String approveId);//

	/**
	 * @description 根据业务ID获取该业务的审批记录
	 * @author fengya
	 * @date 2020年7月1日 下午7:35:21
	 * @param businessId
	 * @return
	 * ResultData
	 */
	@RequestMapping(value = "/comm-work-flow-server/workflow/workflowApprove/findApprovedRecord/{businessId}", method = RequestMethod.GET)
	public ResultData findApprovedRecord(@RequestParam("businessId") String businessId);

}
